﻿using MauiControl.Models;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace MauiControl.Services
{
    public interface IBluetoothService
    {
        // 搜索蓝牙设备
        Task<List<BleDeviceInfo>> SearchDevicesAsync(CancellationToken cancellationToken, Action<BleDeviceInfo> onDeviceAddedCallback);

        // 连接蓝牙设备
        Task<BleDeviceInfo> ConnectDeviceAsync(string deviceId);

        // 读取原始数据
        Task<byte[]> ReadRawDataAsync();

        // 写入数据
        Task WriteDataAsync(byte[] data);

        // 断开连接
        void Disconnect();

        // 获取电池电量
        Task<string> GetBatteryLevelAsync(string deviceId);

        // 数据接收事件
        event EventHandler<byte[]> DataReceived;
    }
}